<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div data-index="1"></div>
    <script>
        var index = document.querySelector("div");
        console.log(index.getAttribute("data-index"));
        index.setAttribute("data-time", 20);
        console.log(index.getAttribute("data-time"));
        console.log(index.dataset["index"]);
    </script>
</body>

</html>